Passed
Pull Request — master (#47)
by
unknown
05:23
created

dropdown.js ➔ _interopDefaultLegacy   B

Complexity

Conditions 7

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 1
dl 0
loc 1
rs 8
c 0
b 0
f 0
1
/*!
2
  * Bootstrap dropdown.js v4.6.0 (https://getbootstrap.com/)
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
  */
6
(function (global, factory) {
7
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
8
  typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util'], factory) :
0 ignored issues
show
Bug introduced by
The variable define seems to be never declared. If this is a global, consider adding a /** global: define */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.jQuery, global.Popper, global.Util));
0 ignored issues
show
Bug introduced by
The variable globalThis seems to be never declared. If this is a global, consider adding a /** global: globalThis */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Best Practice introduced by
If you intend to check if the variable self is declared in the current environment, consider using typeof self === "undefined" instead. This is safe if the variable is not actually declared.
Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
10
}(this, (function ($, Popper, Util) { 'use strict';
11
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
14
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
  var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
16
  var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
17
18
  function _defineProperties(target, props) {
19
    for (var i = 0; i < props.length; i++) {
20
      var descriptor = props[i];
21
      descriptor.enumerable = descriptor.enumerable || false;
22
      descriptor.configurable = true;
23
      if ("value" in descriptor) descriptor.writable = true;
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
24
      Object.defineProperty(target, descriptor.key, descriptor);
25
    }
26
  }
27
28
  function _createClass(Constructor, protoProps, staticProps) {
29
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
30
    if (staticProps) _defineProperties(Constructor, staticProps);
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
31
    return Constructor;
32
  }
33
34
  function _extends() {
35
    _extends = Object.assign || function (target) {
0 ignored issues
show
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. _extends is already defined in line 34 as a function. While this will work, it can be very confusing.
Loading history...
36
      for (var i = 1; i < arguments.length; i++) {
37
        var source = arguments[i];
38
39
        for (var key in source) {
0 ignored issues
show
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
40
          if (Object.prototype.hasOwnProperty.call(source, key)) {
41
            target[key] = source[key];
42
          }
43
        }
44
      }
45
46
      return target;
47
    };
48
49
    return _extends.apply(this, arguments);
50
  }
51
52
  /**
53
   * ------------------------------------------------------------------------
54
   * Constants
55
   * ------------------------------------------------------------------------
56
   */
57
58
  var NAME = 'dropdown';
59
  var VERSION = '4.6.0';
60
  var DATA_KEY = 'bs.dropdown';
61
  var EVENT_KEY = "." + DATA_KEY;
62
  var DATA_API_KEY = '.data-api';
63
  var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
64
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
65
66
  var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
67
68
  var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
69
70
  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
71
72
  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
73
74
  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
75
76
  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
77
  var EVENT_HIDE = "hide" + EVENT_KEY;
78
  var EVENT_HIDDEN = "hidden" + EVENT_KEY;
79
  var EVENT_SHOW = "show" + EVENT_KEY;
80
  var EVENT_SHOWN = "shown" + EVENT_KEY;
81
  var EVENT_CLICK = "click" + EVENT_KEY;
82
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
83
  var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY + DATA_API_KEY;
84
  var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY + DATA_API_KEY;
85
  var CLASS_NAME_DISABLED = 'disabled';
86
  var CLASS_NAME_SHOW = 'show';
87
  var CLASS_NAME_DROPUP = 'dropup';
88
  var CLASS_NAME_DROPRIGHT = 'dropright';
89
  var CLASS_NAME_DROPLEFT = 'dropleft';
90
  var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
91
  var CLASS_NAME_POSITION_STATIC = 'position-static';
92
  var SELECTOR_DATA_TOGGLE = '[data-toggle="dropdown"]';
93
  var SELECTOR_FORM_CHILD = '.dropdown form';
94
  var SELECTOR_MENU = '.dropdown-menu';
95
  var SELECTOR_NAVBAR_NAV = '.navbar-nav';
96
  var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
97
  var PLACEMENT_TOP = 'top-start';
98
  var PLACEMENT_TOPEND = 'top-end';
99
  var PLACEMENT_BOTTOM = 'bottom-start';
100
  var PLACEMENT_BOTTOMEND = 'bottom-end';
101
  var PLACEMENT_RIGHT = 'right-start';
102
  var PLACEMENT_LEFT = 'left-start';
103
  var Default = {
104
    offset: 0,
105
    flip: true,
106
    boundary: 'scrollParent',
107
    reference: 'toggle',
108
    display: 'dynamic',
109
    popperConfig: null
110
  };
111
  var DefaultType = {
112
    offset: '(number|string|function)',
113
    flip: 'boolean',
114
    boundary: '(string|element)',
115
    reference: '(string|element)',
116
    display: 'string',
117
    popperConfig: '(null|object)'
118
  };
119
  /**
120
   * ------------------------------------------------------------------------
121
   * Class Definition
122
   * ------------------------------------------------------------------------
123
   */
124
125
  var Dropdown = /*#__PURE__*/function () {
126
    function Dropdown(element, config) {
127
      this._element = element;
128
      this._popper = null;
129
      this._config = this._getConfig(config);
130
      this._menu = this._getMenuElement();
131
      this._inNavbar = this._detectNavbar();
132
133
      this._addEventListeners();
134
    } // Getters
135
136
137
    var _proto = Dropdown.prototype;
138
139
    // Public
140
    _proto.toggle = function toggle() {
141
      if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED)) {
142
        return;
143
      }
144
145
      var isActive = $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW);
146
147
      Dropdown._clearMenus();
148
149
      if (isActive) {
150
        return;
151
      }
152
153
      this.show(true);
154
    };
155
156
    _proto.show = function show(usePopper) {
157
      if (usePopper === void 0) {
0 ignored issues
show
Coding Style introduced by
Consider using undefined instead of void(0). It is equivalent and more straightforward to read.
Loading history...
158
        usePopper = false;
159
      }
160
161
      if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW)) {
162
        return;
163
      }
164
165
      var relatedTarget = {
166
        relatedTarget: this._element
167
      };
168
      var showEvent = $__default['default'].Event(EVENT_SHOW, relatedTarget);
169
170
      var parent = Dropdown._getParentFromElement(this._element);
171
172
      $__default['default'](parent).trigger(showEvent);
173
174
      if (showEvent.isDefaultPrevented()) {
175
        return;
176
      } // Totally disable Popper for Dropdowns in Navbar
177
178
179
      if (!this._inNavbar && usePopper) {
180
        /**
181
         * Check for Popper dependency
182
         * Popper - https://popper.js.org
183
         */
184
        if (typeof Popper__default['default'] === 'undefined') {
185
          throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
186
        }
187
188
        var referenceElement = this._element;
189
190
        if (this._config.reference === 'parent') {
191
          referenceElement = parent;
192
        } else if (Util__default['default'].isElement(this._config.reference)) {
193
          referenceElement = this._config.reference; // Check if it's jQuery element
194
195
          if (typeof this._config.reference.jquery !== 'undefined') {
196
            referenceElement = this._config.reference[0];
197
          }
198
        } // If boundary is not `scrollParent`, then set position to `static`
199
        // to allow the menu to "escape" the scroll parent's boundaries
200
        // https://github.com/twbs/bootstrap/issues/24251
201
202
203
        if (this._config.boundary !== 'scrollParent') {
204
          $__default['default'](parent).addClass(CLASS_NAME_POSITION_STATIC);
205
        }
206
207
        this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
208
      } // If this is a touch-enabled device we add extra
209
      // empty mouseover listeners to the body's immediate children;
210
      // only needed because of broken event delegation on iOS
211
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
212
213
214
      if ('ontouchstart' in document.documentElement && $__default['default'](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
215
        $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
216
      }
217
218
      this._element.focus();
219
220
      this._element.setAttribute('aria-expanded', true);
221
222
      $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW);
223
      $__default['default'](parent).toggleClass(CLASS_NAME_SHOW).trigger($__default['default'].Event(EVENT_SHOWN, relatedTarget));
224
    };
225
226
    _proto.hide = function hide() {
227
      if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || !$__default['default'](this._menu).hasClass(CLASS_NAME_SHOW)) {
228
        return;
229
      }
230
231
      var relatedTarget = {
232
        relatedTarget: this._element
233
      };
234
      var hideEvent = $__default['default'].Event(EVENT_HIDE, relatedTarget);
235
236
      var parent = Dropdown._getParentFromElement(this._element);
237
238
      $__default['default'](parent).trigger(hideEvent);
239
240
      if (hideEvent.isDefaultPrevented()) {
241
        return;
242
      }
243
244
      if (this._popper) {
245
        this._popper.destroy();
246
      }
247
248
      $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW);
249
      $__default['default'](parent).toggleClass(CLASS_NAME_SHOW).trigger($__default['default'].Event(EVENT_HIDDEN, relatedTarget));
250
    };
251
252
    _proto.dispose = function dispose() {
253
      $__default['default'].removeData(this._element, DATA_KEY);
254
      $__default['default'](this._element).off(EVENT_KEY);
255
      this._element = null;
256
      this._menu = null;
257
258
      if (this._popper !== null) {
259
        this._popper.destroy();
260
261
        this._popper = null;
262
      }
263
    };
264
265
    _proto.update = function update() {
266
      this._inNavbar = this._detectNavbar();
267
268
      if (this._popper !== null) {
269
        this._popper.scheduleUpdate();
270
      }
271
    } // Private
272
    ;
273
274
    _proto._addEventListeners = function _addEventListeners() {
275
      var _this = this;
276
277
      $__default['default'](this._element).on(EVENT_CLICK, function (event) {
278
        event.preventDefault();
279
        event.stopPropagation();
280
281
        _this.toggle();
282
      });
283
    };
284
285
    _proto._getConfig = function _getConfig(config) {
286
      config = _extends({}, this.constructor.Default, $__default['default'](this._element).data(), config);
287
      Util__default['default'].typeCheckConfig(NAME, config, this.constructor.DefaultType);
288
      return config;
289
    };
290
291
    _proto._getMenuElement = function _getMenuElement() {
292
      if (!this._menu) {
293
        var parent = Dropdown._getParentFromElement(this._element);
294
295
        if (parent) {
296
          this._menu = parent.querySelector(SELECTOR_MENU);
297
        }
298
      }
299
300
      return this._menu;
301
    };
302
303
    _proto._getPlacement = function _getPlacement() {
304
      var $parentDropdown = $__default['default'](this._element.parentNode);
305
      var placement = PLACEMENT_BOTTOM; // Handle dropup
306
307
      if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
308
        placement = $__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
309
      } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
310
        placement = PLACEMENT_RIGHT;
311
      } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
312
        placement = PLACEMENT_LEFT;
313
      } else if ($__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
314
        placement = PLACEMENT_BOTTOMEND;
315
      }
316
317
      return placement;
318
    };
319
320
    _proto._detectNavbar = function _detectNavbar() {
321
      return $__default['default'](this._element).closest('.navbar').length > 0;
322
    };
323
324
    _proto._getOffset = function _getOffset() {
325
      var _this2 = this;
326
327
      var offset = {};
328
329
      if (typeof this._config.offset === 'function') {
330
        offset.fn = function (data) {
331
          data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
332
          return data;
333
        };
334
      } else {
335
        offset.offset = this._config.offset;
336
      }
337
338
      return offset;
339
    };
340
341
    _proto._getPopperConfig = function _getPopperConfig() {
342
      var popperConfig = {
343
        placement: this._getPlacement(),
344
        modifiers: {
345
          offset: this._getOffset(),
346
          flip: {
347
            enabled: this._config.flip
348
          },
349
          preventOverflow: {
350
            boundariesElement: this._config.boundary
351
          }
352
        }
353
      }; // Disable Popper if we have a static display
354
355
      if (this._config.display === 'static') {
356
        popperConfig.modifiers.applyStyle = {
357
          enabled: false
358
        };
359
      }
360
361
      return _extends({}, popperConfig, this._config.popperConfig);
362
    } // Static
363
    ;
364
365 View Code Duplication
    Dropdown._jQueryInterface = function _jQueryInterface(config) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
366
      return this.each(function () {
367
        var data = $__default['default'](this).data(DATA_KEY);
368
369
        var _config = typeof config === 'object' ? config : null;
370
371
        if (!data) {
372
          data = new Dropdown(this, _config);
373
          $__default['default'](this).data(DATA_KEY, data);
374
        }
375
376
        if (typeof config === 'string') {
377
          if (typeof data[config] === 'undefined') {
378
            throw new TypeError("No method named \"" + config + "\"");
379
          }
380
381
          data[config]();
382
        }
383
      });
384
    };
385
386
    Dropdown._clearMenus = function _clearMenus(event) {
387
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
388
        return;
389
      }
390
391
      var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
392
393
      for (var i = 0, len = toggles.length; i < len; i++) {
394
        var parent = Dropdown._getParentFromElement(toggles[i]);
395
396
        var context = $__default['default'](toggles[i]).data(DATA_KEY);
397
        var relatedTarget = {
398
          relatedTarget: toggles[i]
399
        };
400
401
        if (event && event.type === 'click') {
402
          relatedTarget.clickEvent = event;
403
        }
404
405
        if (!context) {
406
          continue;
407
        }
408
409
        var dropdownMenu = context._menu;
410
411
        if (!$__default['default'](parent).hasClass(CLASS_NAME_SHOW)) {
412
          continue;
413
        }
414
415
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default['default'].contains(parent, event.target)) {
416
          continue;
417
        }
418
419
        var hideEvent = $__default['default'].Event(EVENT_HIDE, relatedTarget);
420
        $__default['default'](parent).trigger(hideEvent);
421
422
        if (hideEvent.isDefaultPrevented()) {
423
          continue;
424
        } // If this is a touch-enabled device we remove the extra
425
        // empty mouseover listeners we added for iOS support
426
427
428
        if ('ontouchstart' in document.documentElement) {
429
          $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
430
        }
431
432
        toggles[i].setAttribute('aria-expanded', 'false');
433
434
        if (context._popper) {
435
          context._popper.destroy();
436
        }
437
438
        $__default['default'](dropdownMenu).removeClass(CLASS_NAME_SHOW);
439
        $__default['default'](parent).removeClass(CLASS_NAME_SHOW).trigger($__default['default'].Event(EVENT_HIDDEN, relatedTarget));
440
      }
441
    };
442
443
    Dropdown._getParentFromElement = function _getParentFromElement(element) {
444
      var parent;
445
      var selector = Util__default['default'].getSelectorFromElement(element);
446
447
      if (selector) {
448
        parent = document.querySelector(selector);
449
      }
450
451
      return parent || element.parentNode;
452
    } // eslint-disable-next-line complexity
453
    ;
454
455
    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
456
      // If not input/textarea:
457
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
458
      // If input/textarea:
459
      //  - If space key => not a dropdown command
460
      //  - If key is other than escape
461
      //    - If key is not up or down => not a dropdown command
462
      //    - If trigger inside the menu => not a dropdown command
463
      if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default['default'](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
464
        return;
465
      }
466
467
      if (this.disabled || $__default['default'](this).hasClass(CLASS_NAME_DISABLED)) {
468
        return;
469
      }
470
471
      var parent = Dropdown._getParentFromElement(this);
472
473
      var isActive = $__default['default'](parent).hasClass(CLASS_NAME_SHOW);
474
475
      if (!isActive && event.which === ESCAPE_KEYCODE) {
476
        return;
477
      }
478
479
      event.preventDefault();
480
      event.stopPropagation();
481
482
      if (!isActive || event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE) {
483
        if (event.which === ESCAPE_KEYCODE) {
484
          $__default['default'](parent.querySelector(SELECTOR_DATA_TOGGLE)).trigger('focus');
485
        }
486
487
        $__default['default'](this).trigger('click');
488
        return;
489
      }
490
491
      var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
492
        return $__default['default'](item).is(':visible');
493
      });
494
495
      if (items.length === 0) {
496
        return;
497
      }
498
499
      var index = items.indexOf(event.target);
500
501
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
502
        // Up
503
        index--;
504
      }
505
506
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
507
        // Down
508
        index++;
509
      }
510
511
      if (index < 0) {
512
        index = 0;
513
      }
514
515
      items[index].focus();
516
    };
517
518
    _createClass(Dropdown, null, [{
519
      key: "VERSION",
520
      get: function get() {
521
        return VERSION;
522
      }
523
    }, {
524
      key: "Default",
525
      get: function get() {
526
        return Default;
527
      }
528
    }, {
529
      key: "DefaultType",
530
      get: function get() {
531
        return DefaultType;
532
      }
533
    }]);
534
535
    return Dropdown;
536
  }();
537
  /**
538
   * ------------------------------------------------------------------------
539
   * Data Api implementation
540
   * ------------------------------------------------------------------------
541
   */
542
543
544
  $__default['default'](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
545
    event.preventDefault();
546
    event.stopPropagation();
547
548
    Dropdown._jQueryInterface.call($__default['default'](this), 'toggle');
549
  }).on(EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, function (e) {
550
    e.stopPropagation();
551
  });
552
  /**
553
   * ------------------------------------------------------------------------
554
   * jQuery
555
   * ------------------------------------------------------------------------
556
   */
557
558
  $__default['default'].fn[NAME] = Dropdown._jQueryInterface;
559
  $__default['default'].fn[NAME].Constructor = Dropdown;
560
561
  $__default['default'].fn[NAME].noConflict = function () {
562
    $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
563
    return Dropdown._jQueryInterface;
564
  };
565
566
  return Dropdown;
567
568
})));
569
//# sourceMappingURL=dropdown.js.map
570